SOURCES  = predictor_base.cc predictor_const_v.cc predictor_link.cc \
 				   predictor_acceleration.cc predictor_force.cc predictor_pole.cc predictor_target.cc

UTGSOURCES = unit_test.cc predictor_pole_test.cc predictor_force_test.cc predictor_link_test.cc \
             predictor_acceleration_test.cc predictor_target_test.cc predictor_const_v_test.cc

HEADERS  = $(SOURCES:.cc=.h)
OBJECTS  = $(SOURCES:.cc=.o)
UTOBJECTS  = $(UTSOURCES:.cc=.o)
UTGOBJECTS  = $(UTGSOURCES:.cc=.o)

INCLUDE  = -I/sw/include/boost-1_33_1 
CXXFLAGS = -pg -g -O3 $(INCLUDE) -Wall

# Linux
#DEFINES  = -DLinux
#LIBS     = -lglut -lGL -lboost_thread

# OS X
LIBS     = -L/sw/lib -lboost_thread 

all: libpredictors.so unit_tests

libpredictors.so: $(OBJECTS)
	g++ -dynamiclib -O3 -Wall $(INCLUDE) $(OBJECTS) -o libpredictors.so
	cp libpredictors.so ../../predict_qt/
	cp libpredictors.so ..

unit_tests: $(OBJECTS) $(UTGOBJECTS)
	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -L/usr/lib -L/usr/X11R6/lib/ $(OBJECTS) $(UTGOBJECTS) $(LIBS) -lgtest -o $@

#.cc.o:
#	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -c $<

clean:
	rm -f unit_tests gmon.out *.o

tags:   
	etags *.cc *.h

# rule for building dependency lists, and writing them to a file
# named ".depend".
depend: .depend $(HEADERS)
	rm -f .depend
	gcc -M $(DEFINES) $(SOURCES) $(INCLUDE) > .depend

# now add a line to include the dependency list.
include .depend

